<template>
  <div class="login">
    <img src="../assets/img/登录页.jpg" alt="" />
    <van-button round type="info" @click="loginClick">立即登录</van-button>
  </div>
</template>

<script>
import { ChangeLogin } from "@/request/api";
export default {
  data() {
    return {};
  },
  methods: {
    loginClick() {
      ChangeLogin({
        username: "13555555666",
        password: "123456",
      })
        .then((res) => {
          console.log("登录成功");
          localStorage.setItem("token", res.data);
          this.$router.push("/home");
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>
 
<style lang = "less" scoped>
.login {
  width: 100%;
  height: 100%;
  position: relative;
  img {
    display: block;
    width: 100%;
  }
  .van-button {
    width: 130px;
    height: 40px;
    position: absolute;
    bottom: 40px;
    left: 50%;
    margin-left: -65px;
  }
}
</style>